CREATE
OR REPLACE PROCEDURE project_sp_insert_org_bb(p_phid IN NUMBER) 
AS 
    jh_phid BIGINT;
    sp_phid BIGINT;
BEGIN
    -- 查询跟踪项目投标计划的phid
    select user_djly INTO jh_phid from crm3_tend_eval where phid = p_phid;

    INSERT INTO crm3_tend_chk_m(
        phid,
        user_xmmc,
        phid_org,
        user_djly,
        bill_no,
        user_bdmc,
        user_ywlb,
        user_scfw,
        user_xmms,
        user_sccyllb,
        user_tbfzr,
        user_tbdw,
        tend_dt,
        user_tzje,
        bill_dt,
        user_tbr,
        --
        bill_name,
        project_address,
        phid_pc,
        phid_signtype,
        signup_address,
        phid_tendtype,
        phid_turntype,
        phid_chkway,
        senchk_address,
        phid_chkresult,
        linkman,
        mobile,
        remarks,
        asr_flag,
        wf_flag,
        arc_flag,
        phid_app,
        app_status,
        level_code,
        print_count,
        bill_type,
        user_type,
        py,
        phid_schemeid,
        imp_info,
        ng_record_ver,
        creator,
        editor,
        cur_orgid,
        phid_sourcemid,
        item_resource,
        ng_phid_cu,
        ng_phid_bp,
        ng_phid_org,
        ng_phid_ui_scheme,
        ng_phid_original,
        ng_orgid_original,
        ng_sv_search_key,
        ng_sd_search_key,
        ng_share_sign,
        isimport,
        list_filter_val,
        query_field1_val,
        query_field2_val,
        uimulti_config_id,
        ng_write_source
    )
    SELECT 
        seq_auto_phid_project_sp_org_bb.nextval,
        project_name,
        phid_org,
        p_phid,
        bill_no,
        user_bdmc,
        user_yelb,
        user_scfw,
        user_xmms,
        user_sccyllb,
        phid_tenpsn,
        user_tbdw,
        user_tbsj,
        user_tzje,
        bill_dt,
        phid_tbpsn,
        --
        '',
        '',
        jh_phid,
        0,
        '',
        0,
        0,
        0,
        '',
        0,
        '',
        '',
        '',
        0,
        null,
        null,
        null,
        0,
        0,
        0,
        '',
        '',
        '',
        6870000000000035,
        '',
        1,
        6870000000000009,
        6870000000000009,
        1,
        0,
        '',
        1,
        0,
        1,
        0,
        0,
        0,
        '10',
        '1',
        5,
        0,
        null,
        null,
        null,
        null,
        null
    FROM crm3_advance_project
    WHERE phid = jh_phid;
    commit;
    EXCEPTION 
    WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('插入失败，错误信息：' || SQLERRM);
    ROLLBACK;
    RAISE;
END project_sp_insert_org_bb;